package com.bdqn.t350.ch04mybatisplus.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

//FilterConfig  filterConfig = new FilterConfig();
//@Configuration
public class FilterConfig {

    @Resource
    SessionFilter sessionFilter;

    //注册到过滤器链
    @Bean
    public FilterRegistrationBean filterRegist() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        //registration.setFilter(new SessionFilter());
        registration.setFilter(sessionFilter);
        registration.setName("sessionFilter");
        registration.addUrlPatterns("/welcome/index");//作为演示，仅仅只限制/main 访问
        //registration.setOrder(5);
        return registration;
    }
}